!lm12
!rm75
Adding Auto-SAVE to S-C Macro Assembler........Greg H. Anders

[ Greg is a subscriber from Albuquerque, New Mexico. ]

One of the nice features of the new S-C Macro Assembler is the title directive (.TI).  This directive causes a title and page number to be printed at the top of each page of an assembly listing.  The title directive gave me the idea for the Automatic Save command program which follows.

I felt the need for an Auto Save command because of my own carelessness.  After extensive editing of a rather lengthy program, I decided it was a good time to save the program before I proceeded.  The file names I use are usually descriptive and forgettable, so to save a file, I list the Catalog, then use the cursor controls to copy the file name.  After the file name appeared on the screen, I zipped the cursor next to the name I wanted to save the file under and, succumbing to temporary insanity, typed an "L".  The word "LOAD" flashed on the screen and my mouth dropped open in disbelief.  The only sounds that could be heard were the whirr of the disk drive and the screams of my new code byting the dust cover!
!np
I decided to try to simplify the task of saving a program, giving myself less chance of making an error.  From this came the Auto Save command.  With this command, typing SAVE does not save your program on cassette.  Instead, the SAVE command searches your source program for a title.  If a title is found and it is a valid DOS name, the source program is automatically saved, using the title as the file name.  In addition, if you end your title with a version number in the form N.N, Auto Save automatically increments the version number in the source program and saves the program using the new version number.  The version number option does not erase your old file, which means your old file is a back-up.  Be careful, though.  A few saves and your disk is full of back-up files.  You'll need to go back and delete a file or two every once in a while. 

The version number goes up to a maximum of 9.9, after which it starts back at 0.0.  If the version number option is not desired, don't put a number in the form N.N at the end of your title.

Leading and trailing blanks are ignored by Auto Save.  If there is more than one consecutive blank in a title, the blanks are compressed to one.  Thus, the title ".TI 56,TI       TLE" generates a SAVE to the file named "TI TLE".  Also, any commas in your title are changed to dashes so as not to confuse DOS.
!np
To use the Auto Save command, the vector address of the SAVE command must be changed.  The address must be one less than the actual start of the Auto Save command.  For example, if Auto Save is assembled at $800, the address would be changed in the table inside the S-C Macro Assembler to $07FF.


For the version of the S-C Macro Assembler which loads at $1000, change the contents of address $1679 to $07 and $1678 to $FF.  Shown as a monitor command, this would be:

     :$1678:FF 07  

For the Language Card version of the S-C Macro Assembler, change the content of address $D679 to $07 and $D678 to $FF.  You have to write-enable the card first:

     :$C083 C083 D678:FF 07


I like to keep Auto Save behind the Language Card version of the Macro Assembler.  I put the program at $F320 and the changes are:

     :$C083 C083 D678:1F F3
!np
One thing you'll have to look out for.  If you type an illegal DOS SAVE command such as "SAVE 1 4 THE ROAD", DOS ignores this command and the Auto Save goes into effect; the "1 4 THE ROAD" is ignored.  Also note that the save is performed on the drive that is active.  Since commas are changed to dashes, there is currently no way to specify which drive you want the save to be performed on.  Perhaps you would like to try to implement this enhancement yourself.

After you've installed the Auto Save program, type in this program:

     1000 *    A TEST OF AUTO SAVE
     1010      .TI 54, TITLE TEST VER. 0.9

Then type SAVE, and CATALOG.  See how the file was saved?  List the file and notice the change in line 1010.  Voila!

For those of you who haven't updated to the Macro Assembler yet, Auto Save can be implemented with S-C Version 4.0 by using the .US command for the title.  The changes which are necessary are outlined below.
!lm17

1.  The following lines must be deleted:  1490-1540, 2090-2150, 2460-2470, 2560-2930.

2.  The following lines must be added:

1210        .US S-C VER. 4.0 AUTO SAVE 1.0
1600        BNE .2       ...ALWAYS
1920 *   CHECK THE OP CODE FOR .US
2170        BCS TITLE
2480 .1     CMP #$80
3480 OPS    .AS /.US/
3510 NO.TTL .AS /*** NO TITLE ERRO/
3515        .AS  -/R/
3520        .AS /*** ILLEGAL TITLE FIRST CHARACTE/
3525        .AS  -/R/

3.  Change the SAVE vector address.  For an origin of $800, that would be

     :$1271:FF 07

4.  To use the command, put the title you want to use for the file name like so:
     .US MY TITLE VER. 1.0
